#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;


int random1()
{
    if (rand()%2 == 0)
        return 0;
    else 
        return 1;
}

int randomn(double p)
{
    unsigned int num = p * 0xFFFFFFFF;
    //cout << num << endl;
    //genereate a num 
    unsigned int result = 0;
    for (int i = 0; i < 32; i++) {
        if (random1())
            result |= 1 << i;
    }
    if (result < num) 
        return 1;
    else return 0; 
}


int main(int argc, char **argv)
{
    int count0 = 0, count1 = 1;

    srand (time(NULL) );

    for (int i = 0; i < 100000; i++) {
        if (randomn(0.8) == 0)
            count0 ++;
        else 
            count1++;
    }
    cout << count0 << " " << count1 << endl;
    double a = (double)count0/(double)(100000);
    double b = (double)count1/(double)(100000);
    cout << a << " " << b << endl;

    cout << "-----------------Test 1--------------------" << endl;


    cout << "-----------------Test 2--------------------" << endl;


    cout << "-----------------Test 3--------------------" << endl;


    cout << "-----------------Test 4--------------------" << endl;


    cout << "-----------------Test 5--------------------" << endl;



}
